package com.huitone.gddw.service.impl.monitoring.environment.host;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.huitone.gddw.common.ComConstant;
import com.huitone.gddw.dao.monitoring.environment.ISystemMonitorDao;
import com.huitone.gddw.service.dto.monitoring.environment.EnvDTO;
import com.huitone.gddw.service.monitoring.environment.host.ISystemMonitorService;

/**
 * 系统监控
 * @author wuluodan
 *
 */
@Service
public class SystemMonitorService implements ISystemMonitorService {

	@Autowired
	private ISystemMonitorDao systemMonitorDao;
	
	@Override
	public List<EnvDTO> findHostBasic(String objId) {
		Map<String, Object> params = new HashMap<>();
		params.put("objId", objId);
		params.put("objType", ComConstant.HOST);
		params.put("itemName", ComConstant.BASIC);
		return systemMonitorDao.findHostBasic(params);
	}

	@Override
	public List<EnvDTO> findHostHardware(String objId) {
		Map<String, Object> params = new HashMap<>();
		params.put("objId", objId);
		params.put("objType", ComConstant.HOST);
		params.put("itemName", ComConstant.HARDWARE);
		return systemMonitorDao.findHostHardware(params);
	}

	@Override
	public List<EnvDTO> findHostTask(String objId) {
		Map<String, Object> params = new HashMap<>();
		params.put("objId", objId);
		params.put("objType", ComConstant.HOST);
		params.put("itemName", ComConstant.TASK);
		return systemMonitorDao.findHostTask(params);
	}

	@Override
	public List<EnvDTO> findHostRecuse(Map<String, Object> params) {
		params.put("objType", ComConstant.HOST);
		params.put("list", Arrays.asList(ComConstant.RECUSE, ComConstant.HARDWARE));
		return systemMonitorDao.findHostRecuse(params);
	}

	@Override
	public List<EnvDTO> findHostPid(String objId) {
		Map<String, Object> params = new HashMap<>();
		params.put("objId", objId);
		params.put("objType", ComConstant.HOST);
		params.put("itemName", ComConstant.PID);
		return systemMonitorDao.findHostPid(params);
	}

}
